{% extends 'org_detail_base.html' %}

{% load staticfiles %}

{% block title %}
    授课机构 - 课程
{% endblock %}

{% block org_detail_right %}
    <div class="right companycenter layout">
        <div class="head">
            <h1>机构课程</h1>
        </div>
        <div class="brief group_list">

            {% for course in course_paginator.object_list %}
                <div class="module1_5 box">
                    <a class="comp-img-box" href="{% url 'course:detail' course.id %}">

                        <img width="214" height="195" src="{{ MEDIA_URL }}{{ course.image }}"/>
                    </a>
                    <div class="des">
                        <a href="{% url 'course:detail' course.id %}"><h2>{{ course.name }}</h2></a>
                        <span class="fl">课时：<i class="key">{{ course.learn_times }}</i></span>
                        <span class="fr">学习人数：{{ course.students }}</span>
                    </div>
                    <div class="bottom">
                        <span class="fl">{{ course.course_org.name }}</span>
                        <span class="star fr  notlogin
                            " data-favid="13" data-fav-type="4">
                            {{ course.fav_nums }}
                        </span>
                    </div>
                </div>
            {% endfor %}

        </div>
    
        {# 分页 #}
        {% load i18n %}
        <div class="pageturn">
            <ul class="pagelist">

                {# 上一页 #}
                {% if course_paginator.has_previous %}
                    <li class="long">
                        {# *.querystring 如: 'page=1' #}
                        <a href="?{{ course_paginator.previous_page_number.querystring }}">
                            上一页
                        </a>
                    </li>
                {% endif %}

                {# 分页主体 #}
                {% for page in course_paginator.pages %}
                    {# p.pages返回如: 1, 2, None, 5, 6, None, 9 #}
                    {% if page %}
                        {# 当前页面高亮显示 #}
                        <li{% if page == course_paginator.number %} class="active"{% endif %}>
                            <a href="?{{ page.querystring }}">
                                {{ page }}
                            </a>
                        </li>
                    {% else %}
                        <li>...</li>
                    {% endif %}
                {% endfor %}

                {# 下一页 #}
                {% if course_paginator.has_next %}
                    <li class="long">
                        <a href="?{{ course_paginator.next_page_number.querystring }}">
                            下一页
                        </a>
                    </li>
                {% endif %}
            </ul>
        </div>
    </div>
{% endblock %}